#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPaintEvent>
#include "myblock.h"
#include <QMediaPlayer>
#include <QMediaPlaylist>
#include <QSoundEffect>
#include <QLabel>
#include <QPropertyAnimation>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class tablePoint
{
public:
    int color;
    bool dropping;
};

class MoveBlocks
{
public:
    int dropStep;
    int leftRight;
};


class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void paintEvent(QPaintEvent *);

    void drawBlocks(MyBlock * block);

    void dropBlocks(MyBlock * block); // 下落

    void moveBlocks(MyBlock * block, int move); // 左右移动

    void changeBlocks(MyBlock * block); // 变形

    void clearLine();

    void keyPressEvent(QKeyEvent *ev);


    bool gameStart;
    tablePoint disTable[20][10];
    int color;
    QTimer *timer1; // 降落使用
    bool failure;
    QMediaPlayer * player;
    QLabel * successLabel;
    QPropertyAnimation * successAnimation;

signals:
    void leftKeyPressed(int);
    void rightKeyPressed(int);
    void downKeyPressed();
    void blankKeyPressed();
    void failed();

private:
    Ui::MainWindow *ui;


};
#endif // MAINWINDOW_H
